package cn.gson.springmvc.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "destry_details", schema = "jinsanjiao", catalog = "")
public class DestryDetails {
    private int destryDetailsId;
    private Long destroyDetailsQuantity;
    private Inventory inventoryByInventoryNumber;
    private Destroy destroyByDestroyId;

    @Id
    @Column(name = "destry_details_id", nullable = false)
    public int getDestryDetailsId() {
        return destryDetailsId;
    }

    public void setDestryDetailsId(int destryDetailsId) {
        this.destryDetailsId = destryDetailsId;
    }

    @Basic
    @Column(name = "destroy_details_quantity", nullable = true, precision = 0)
    public Long getDestroyDetailsQuantity() {
        return destroyDetailsQuantity;
    }

    public void setDestroyDetailsQuantity(Long destroyDetailsQuantity) {
        this.destroyDetailsQuantity = destroyDetailsQuantity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DestryDetails that = (DestryDetails) o;
        return destryDetailsId == that.destryDetailsId &&
                Objects.equals(destroyDetailsQuantity, that.destroyDetailsQuantity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(destryDetailsId, destroyDetailsQuantity);
    }

    @ManyToOne
    @JoinColumn(name = "inventory_number", referencedColumnName = "inventory_number")
    public Inventory getInventoryByInventoryNumber() {
        return inventoryByInventoryNumber;
    }

    public void setInventoryByInventoryNumber(Inventory inventoryByInventoryNumber) {
        this.inventoryByInventoryNumber = inventoryByInventoryNumber;
    }

    @ManyToOne
    @JoinColumn(name = "destroy_id", referencedColumnName = "destroy_id")
    public Destroy getDestroyByDestroyId() {
        return destroyByDestroyId;
    }

    public void setDestroyByDestroyId(Destroy destroyByDestroyId) {
        this.destroyByDestroyId = destroyByDestroyId;
    }
}
